<!DOCTYPE html>

















































<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  <meta name="description" content="Javadoc API documentation for Fresco." />

<link rel="shortcut icon" type="image/x-icon" href="../../../../favicon.ico" />
<title>

  CloseableReference - Fresco API


| Fresco

</title>
<link href="../../../../../assets/doclava-developer-docs.css" rel="stylesheet" type="text/css" />
<link href="../../../../../assets/customizations.css" rel="stylesheet" type="text/css" />
<script src="../../../../../assets/search_autocomplete.js" type="text/javascript"></script>
<script src="../../../../../assets/jquery-resizable.min.js" type="text/javascript"></script>
<script src="../../../../../assets/doclava-developer-docs.js" type="text/javascript"></script>
<script src="../../../../../assets/prettify.js" type="text/javascript"></script>
<script type="text/javascript">
  setToRoot("../../../../", "../../../../../assets/");
</script>
<script src="../../../../../assets/doclava-developer-reference.js" type="text/javascript"></script>
<script src="../../../../../assets/navtree_data.js" type="text/javascript"></script>
<script src="../../../../../assets/customizations.js" type="text/javascript"></script>
<noscript>
  <style type="text/css">
    html,body{overflow:auto;}
    #body-content{position:relative; top:0;}
    #doc-content{overflow:visible;border-left:3px solid #666;}
    #side-nav{padding:0;}
    #side-nav .toggle-list ul {display:block;}
    #resize-packages-nav{border-bottom:3px solid #666;}
  </style>
</noscript>
</head>

<body class="">

<div id="header">
    <div id="headerLeft">
    
      <span id="masthead-title">Fresco</span>
    
    </div>
    <div id="headerRight">
      
  <div id="search" >
      <div id="searchForm">
          <form accept-charset="utf-8" class="gsc-search-box" 
                onsubmit="return submit_search()">
            <table class="gsc-search-box" cellpadding="0" cellspacing="0"><tbody>
                <tr>
                  <td class="gsc-input">
                    <input id="search_autocomplete" class="gsc-input" type="text" size="33" autocomplete="off"
                      title="search developer docs" name="q"
                      value="search developer docs"
                      onFocus="search_focus_changed(this, true)"
                      onBlur="search_focus_changed(this, false)"
                      onkeydown="return search_changed(event, true, '../../../../')"
                      onkeyup="return search_changed(event, false, '../../../../')" />
                  <div id="search_filtered_div" class="no-display">
                      <table id="search_filtered" cellspacing=0>
                      </table>
                  </div>
                  </td>
                  <td class="gsc-search-button">
                    <input type="submit" value="Search" title="search" id="search-button" class="gsc-search-button" />
                  </td>
                  <td class="gsc-clear-button">
                    <div title="clear results" class="gsc-clear-button">&nbsp;</div>
                  </td>
                </tr></tbody>
              </table>
          </form>
      </div><!-- searchForm -->
  </div><!-- search -->
      
    </div>
</div><!-- header -->


  <div class="g-section g-tpl-240" id="body-content">
    <div class="g-unit g-first side-nav-resizable" id="side-nav">
      <div id="swapper">
        <div id="nav-panels">
          <div id="resize-packages-nav">
            <div id="packages-nav">
              <div id="index-links">
                <a href="../../../../packages.html"  >Package Index</a> | 
                <a href="../../../../classes.html" >Class Index</a>
              </div>
              <ul>
                
    <li class="api apilevel-">
  <a href="../../../../com/facebook/binaryresource/package-summary.html">com.facebook.binaryresource</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/cache/common/package-summary.html">com.facebook.cache.common</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/cache/disk/package-summary.html">com.facebook.cache.disk</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/common/disk/package-summary.html">com.facebook.common.disk</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/common/internal/package-summary.html">com.facebook.common.internal</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/common/logging/package-summary.html">com.facebook.common.logging</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/common/memory/package-summary.html">com.facebook.common.memory</a></li>
    <li class="selected api apilevel-">
  <a href="../../../../com/facebook/common/references/package-summary.html">com.facebook.common.references</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/datasource/package-summary.html">com.facebook.datasource</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/drawee/backends/pipeline/package-summary.html">com.facebook.drawee.backends.pipeline</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/drawee/backends/volley/package-summary.html">com.facebook.drawee.backends.volley</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/drawee/controller/package-summary.html">com.facebook.drawee.controller</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/drawee/drawable/package-summary.html">com.facebook.drawee.drawable</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/drawee/generic/package-summary.html">com.facebook.drawee.generic</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/drawee/interfaces/package-summary.html">com.facebook.drawee.interfaces</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/drawee/view/package-summary.html">com.facebook.drawee.view</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/imagepipeline/animated/base/package-summary.html">com.facebook.imagepipeline.animated.base</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/imagepipeline/animated/factory/package-summary.html">com.facebook.imagepipeline.animated.factory</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/imagepipeline/animated/impl/package-summary.html">com.facebook.imagepipeline.animated.impl</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/imagepipeline/animated/util/package-summary.html">com.facebook.imagepipeline.animated.util</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/imagepipeline/backends/okhttp3/package-summary.html">com.facebook.imagepipeline.backends.okhttp3</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/imagepipeline/bitmaps/package-summary.html">com.facebook.imagepipeline.bitmaps</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/imagepipeline/cache/package-summary.html">com.facebook.imagepipeline.cache</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/imagepipeline/common/package-summary.html">com.facebook.imagepipeline.common</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/imagepipeline/core/package-summary.html">com.facebook.imagepipeline.core</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/imagepipeline/datasource/package-summary.html">com.facebook.imagepipeline.datasource</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/imagepipeline/decoder/package-summary.html">com.facebook.imagepipeline.decoder</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/imagepipeline/image/package-summary.html">com.facebook.imagepipeline.image</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/imagepipeline/listener/package-summary.html">com.facebook.imagepipeline.listener</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/imagepipeline/memory/package-summary.html">com.facebook.imagepipeline.memory</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/imagepipeline/producers/package-summary.html">com.facebook.imagepipeline.producers</a></li>
    <li class="api apilevel-">
  <a href="../../../../com/facebook/imagepipeline/request/package-summary.html">com.facebook.imagepipeline.request</a></li>
              </ul><br/>
            </div> <!-- end packages -->
          </div> <!-- end resize-packages -->
          <div id="classes-nav">
            <ul>
              
    <li><h2>Interfaces</h2>
      <ul>
          <li class="api apilevel-"><a href="../../../../com/facebook/common/references/ResourceReleaser.html">ResourceReleaser</a>&lt;T&gt;</li>
      </ul>
    </li>
              
    <li><h2>Classes</h2>
      <ul>
          <li class="selected api apilevel-"><a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt;</li>
          <li class="api apilevel-"><a href="../../../../com/facebook/common/references/SharedReference.html">SharedReference</a>&lt;T&gt;</li>
      </ul>
    </li>
              
              
              
    <li><h2>Exceptions</h2>
      <ul>
          <li class="api apilevel-"><a href="../../../../com/facebook/common/references/SharedReference.NullReferenceException.html">SharedReference.NullReferenceException</a></li>
      </ul>
    </li>
              
            </ul><br/>
          </div><!-- end classes -->
        </div><!-- end nav-panels -->
        <div id="nav-tree" style="display:none">
          <div id="index-links">
            <a href="../../../../packages.html"  >Package Index</a> | 
            <a href="../../../../classes.html" >Class Index</a>
          </div>
        </div><!-- end nav-tree -->
      </div><!-- end swapper -->
    </div> <!-- end side-nav -->
    <script>
      if (!isMobile) {
        $("<a href='#' id='nav-swap' onclick='swapNav();return false;' style='font-size:10px;line-height:9px;margin-left:1em;text-decoration:none;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a>").appendTo("#side-nav");
        chooseDefaultNav();
        if ($("#nav-tree").is(':visible')) {
          init_default_navtree("../../../../");
        } else {
          addLoadEvent(function() {
            scrollIntoView("packages-nav");
            scrollIntoView("classes-nav");
          });
        }
        $("#swapper").css({borderBottom:"2px solid #aaa"});
      } else {
        swapNav(); // tree view should be used on mobile
      }
    </script>



<div class="g-unit" id="doc-content">

<div id="api-info-block">



  
   
  
  
  
  

  
   
  
  
  
  

  
   
  
  
  
  

  
  
  
  


<div class="sum-details-links">


Summary:











  <a href="#pubmethods">Methods</a>
  


  &#124; <a href="#promethods">Protected Methods</a>
  


  &#124; <a href="#inhmethods">Inherited Methods</a>

&#124; <a href="#" onclick="return toggleAllClassInherited()" id="toggleAllClassInherited">[Expand All]</a>

</div><!-- end sum-details-links -->
<div class="api-level">
  


  
  

</div>
</div><!-- end api-info-block -->


<!-- ======== START OF CLASS DATA ======== -->

<div id="jd-header">
    public
     
    final 
    
    class
<h1>CloseableReference</h1>



  
    extends Object<br/>
  
  
  

  
  
      implements 
      
        Closeable 
      
        Cloneable 
      
  
  


</div><!-- end header -->

<div id="naMessage"></div>

<div id="jd-content" class="api apilevel-">
<table class="jd-inheritance-table">


    <tr>
         	
        <td colspan="2" class="jd-inheritance-class-cell">java.lang.Object</td>
    </tr>
    

    <tr>
        
            <td class="jd-inheritance-space">&nbsp;&nbsp;&nbsp;&#x21b3;</td>
         	
        <td colspan="1" class="jd-inheritance-class-cell">com.facebook.common.references.CloseableReference&lt;T&gt;</td>
    </tr>
    

</table>







<div class="jd-descr">


<h2>Class Overview</h2>
<p>A smart pointer-like class for Java.

 <p>This class allows reference-counting semantics in a Java-friendlier way. A single object
 can have any number of CloseableReferences pointing to it. When all of these have been closed,
 the object either has its <code><a href="null#close()">close()</a></code> method called, if it implements
 Closeable, or its designated <code><a href="../../../../com/facebook/common/references/ResourceReleaser.html#release(T)">release(T)</a></code>,
 if it does not.

 <p>Callers can construct a CloseableReference wrapping a Closeable with:
 <pre>
 Closeable foo;
 CloseableReference c = CloseableReference.of(foo);
 </pre>
 <p>Objects that do not implement Closeable can still use this class, but must supply a
 <code><a href="../../../../com/facebook/common/references/ResourceReleaser.html">ResourceReleaser</a></code>:
 <pre>
 <code>Object foo;
 ResourceReleaser&lt;Object&gt; fooReleaser;
 CloseableReference c = CloseableReference.of(foo, fooReleaser);
 </code>
 </pre>
 <p>When making a logical copy, callers should call <code><a href="../../../../com/facebook/common/references/CloseableReference.html#clone()">clone()</a></code>:
 <pre>
 CloseableReference copy = c.clone();
 </pre>
 <p>
 When each copy of CloseableReference is no longer needed, close should be called:
 <pre>
 copy.close();
 c.close();
 </pre>

 <p>As with any Closeable, try-finally semantics may be needed to ensure that close is called.
 <p>Do not rely upon the finalizer; the purpose of this class is for expensive resources to
 be released without waiting for the garbage collector. The finalizer will log an error if
 the close method has not bee called.
</p>





</div><!-- jd-descr -->
















<div class="jd-descr">


<h2>Summary</h2>



























<!-- ========== METHOD SUMMARY =========== -->
<table id="pubmethods" class="jd-sumtable"><tr><th colspan="12">Public Methods</th></tr>



	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol">
            
            synchronized
            
            
            
            <a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt;
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad"><a href="../../../../com/facebook/common/references/CloseableReference.html#clone()">clone</a></span>()
        
        <div class="jd-descrdiv">Returns a new CloseableReference to the same underlying SharedReference.</div>
  
  </td></tr>


	 
    <tr class=" api apilevel-" >
        <td class="jd-typecol">
            
            
            
            static
            &lt;T&gt;
            <a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt;
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad"><a href="../../../../com/facebook/common/references/CloseableReference.html#cloneOrNull(com.facebook.common.references.CloseableReference<T>)">cloneOrNull</a></span>(<a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt; ref)
        
        <div class="jd-descrdiv">Returns the cloned reference if valid, null otherwise.</div>
  
  </td></tr>


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol">
            
            
            
            static
            &lt;T&gt;
            List&lt;<a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt;&gt;
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad"><a href="../../../../com/facebook/common/references/CloseableReference.html#cloneOrNull(java.util.Collection<com.facebook.common.references.CloseableReference<T>>)">cloneOrNull</a></span>(Collection&lt;<a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt;&gt; refs)
        
        <div class="jd-descrdiv">Clones a collection of references and returns a list.</div>
  
  </td></tr>


	 
    <tr class=" api apilevel-" >
        <td class="jd-typecol">
            
            synchronized
            
            
            
            <a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt;
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad"><a href="../../../../com/facebook/common/references/CloseableReference.html#cloneOrNull()">cloneOrNull</a></span>()
        
  </td></tr>


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol">
            
            
            
            
            
            void
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad"><a href="../../../../com/facebook/common/references/CloseableReference.html#close()">close</a></span>()
        
        <div class="jd-descrdiv">Closes this CloseableReference.</div>
  
  </td></tr>


	 
    <tr class=" api apilevel-" >
        <td class="jd-typecol">
            
            
            
            static
            
            void
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad"><a href="../../../../com/facebook/common/references/CloseableReference.html#closeSafely(java.lang.Iterable<? extends com.facebook.common.references.CloseableReference<?>>)">closeSafely</a></span>(Iterable&lt;?&nbsp;extends&nbsp;<a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;?&gt;&gt; references)
        
        <div class="jd-descrdiv">Closes the references in the iterable handling null.</div>
  
  </td></tr>


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol">
            
            
            
            static
            
            void
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad"><a href="../../../../com/facebook/common/references/CloseableReference.html#closeSafely(com.facebook.common.references.CloseableReference<?>)">closeSafely</a></span>(<a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;?&gt; ref)
        
        <div class="jd-descrdiv">Closes the reference handling null.</div>
  
  </td></tr>


	 
    <tr class=" api apilevel-" >
        <td class="jd-typecol">
            
            synchronized
            
            
            
            T
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad"><a href="../../../../com/facebook/common/references/CloseableReference.html#get()">get</a></span>()
        
        <div class="jd-descrdiv">Returns the underlying Closeable if this reference is not closed yet.</div>
  
  </td></tr>


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol">
            
            synchronized
            
            
            
            <a href="../../../../com/facebook/common/references/SharedReference.html">SharedReference</a>&lt;T&gt;
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad"><a href="../../../../com/facebook/common/references/CloseableReference.html#getUnderlyingReferenceTestOnly()">getUnderlyingReferenceTestOnly</a></span>()
        
        <div class="jd-descrdiv">A test-only method to get the underlying references.</div>
  
  </td></tr>


	 
    <tr class=" api apilevel-" >
        <td class="jd-typecol">
            
            synchronized
            
            
            
            int
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad"><a href="../../../../com/facebook/common/references/CloseableReference.html#getValueHash()">getValueHash</a></span>()
        
        <div class="jd-descrdiv">Method used for tracking Closeables pointed by CloseableReference.</div>
  
  </td></tr>


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol">
            
            synchronized
            
            
            
            boolean
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad"><a href="../../../../com/facebook/common/references/CloseableReference.html#isValid()">isValid</a></span>()
        
        <div class="jd-descrdiv">Checks if this closable-reference is valid i.e.</div>
  
  </td></tr>


	 
    <tr class=" api apilevel-" >
        <td class="jd-typecol">
            
            
            
            static
            
            boolean
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad"><a href="../../../../com/facebook/common/references/CloseableReference.html#isValid(com.facebook.common.references.CloseableReference<?>)">isValid</a></span>(<a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;?&gt; ref)
        
        <div class="jd-descrdiv">Checks if the closable-reference is valid i.e.</div>
  
  </td></tr>


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol">
            
            
            
            static
            &lt;T&nbsp;extends&nbsp;Closeable&gt;
            <a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt;
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad"><a href="../../../../com/facebook/common/references/CloseableReference.html#of(T)">of</a></span>(T t)
        
        <div class="jd-descrdiv">Constructs a CloseableReference.</div>
  
  </td></tr>


	 
    <tr class=" api apilevel-" >
        <td class="jd-typecol">
            
            
            
            static
            &lt;T&gt;
            <a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt;
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad"><a href="../../../../com/facebook/common/references/CloseableReference.html#of(T, com.facebook.common.references.ResourceReleaser<T>)">of</a></span>(T t, <a href="../../../../com/facebook/common/references/ResourceReleaser.html">ResourceReleaser</a>&lt;T&gt; resourceReleaser)
        
        <div class="jd-descrdiv">Constructs a CloseableReference (wrapping a SharedReference) of T with provided
 ResourceReleaser<T>.</div>
  
  </td></tr>



</table>




<!-- ========== METHOD SUMMARY =========== -->
<table id="promethods" class="jd-sumtable"><tr><th colspan="12">Protected Methods</th></tr>



	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol">
            
            
            
            
            
            void
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad"><a href="../../../../com/facebook/common/references/CloseableReference.html#finalize()">finalize</a></span>()
        
  </td></tr>



</table>





<!-- ========== METHOD SUMMARY =========== -->
<table id="inhmethods" class="jd-sumtable"><tr><th>
  <a href="#" class="toggle-all" onclick="return toggleAllInherited(this, null)">[Expand]</a>
  <div style="clear:left;">Inherited Methods</div></th></tr>


<tr class="api apilevel-" >
<td colspan="12">
  <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.Object" class="jd-expando-trigger closed"
          ><img id="inherited-methods-java.lang.Object-trigger"
          src="../../../../../assets/images/triangle-closed.png"
          class="jd-expando-trigger-img" /></a>
From class

  java.lang.Object

<div id="inherited-methods-java.lang.Object">
  <div id="inherited-methods-java.lang.Object-list"
        class="jd-inheritedlinks">
  </div>
  <div id="inherited-methods-java.lang.Object-summary" style="display: none;">
    <table class="jd-sumtable-expando">
    


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol">
            
            
            
            
            
            Object
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad">clone</span>()
        
  </td></tr>


	 
    <tr class=" api apilevel-" >
        <td class="jd-typecol">
            
            
            
            
            
            boolean
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad">equals</span>(Object arg0)
        
  </td></tr>


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol">
            
            
            
            
            
            void
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad">finalize</span>()
        
  </td></tr>


	 
    <tr class=" api apilevel-" >
        <td class="jd-typecol">
            
            
            final
            
            
            Class&lt;?&gt;
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad">getClass</span>()
        
  </td></tr>


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol">
            
            
            
            
            
            int
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad">hashCode</span>()
        
  </td></tr>


	 
    <tr class=" api apilevel-" >
        <td class="jd-typecol">
            
            
            final
            
            
            void
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad">notify</span>()
        
  </td></tr>


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol">
            
            
            final
            
            
            void
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad">notifyAll</span>()
        
  </td></tr>


	 
    <tr class=" api apilevel-" >
        <td class="jd-typecol">
            
            
            
            
            
            String
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad">toString</span>()
        
  </td></tr>


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol">
            
            
            final
            
            
            void
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad">wait</span>(long arg0, int arg1)
        
  </td></tr>


	 
    <tr class=" api apilevel-" >
        <td class="jd-typecol">
            
            
            final
            
            
            void
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad">wait</span>(long arg0)
        
  </td></tr>


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol">
            
            
            final
            
            
            void
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad">wait</span>()
        
  </td></tr>


</table>
  </div>
</div>
</td></tr>



<tr class="api apilevel-" >
<td colspan="12">
  <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.io.Closeable" class="jd-expando-trigger closed"
          ><img id="inherited-methods-java.io.Closeable-trigger"
          src="../../../../../assets/images/triangle-closed.png"
          class="jd-expando-trigger-img" /></a>
From interface

  java.io.Closeable

<div id="inherited-methods-java.io.Closeable">
  <div id="inherited-methods-java.io.Closeable-list"
        class="jd-inheritedlinks">
  </div>
  <div id="inherited-methods-java.io.Closeable-summary" style="display: none;">
    <table class="jd-sumtable-expando">
    


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol">
            abstract
            
            
            
            
            void
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad">close</span>()
        
  </td></tr>


</table>
  </div>
</div>
</td></tr>



<tr class="api apilevel-" >
<td colspan="12">
  <a href="#" onclick="return toggleInherited(this, null)" id="inherited-methods-java.lang.AutoCloseable" class="jd-expando-trigger closed"
          ><img id="inherited-methods-java.lang.AutoCloseable-trigger"
          src="../../../../../assets/images/triangle-closed.png"
          class="jd-expando-trigger-img" /></a>
From interface

  java.lang.AutoCloseable

<div id="inherited-methods-java.lang.AutoCloseable">
  <div id="inherited-methods-java.lang.AutoCloseable-list"
        class="jd-inheritedlinks">
  </div>
  <div id="inherited-methods-java.lang.AutoCloseable-summary" style="display: none;">
    <table class="jd-sumtable-expando">
    


	 
    <tr class="alt-color api apilevel-" >
        <td class="jd-typecol">
            abstract
            
            
            
            
            void
        </td>
        <td class="jd-linkcol" width="100%">
        <span class="sympad">close</span>()
        
  </td></tr>


</table>
  </div>
</div>
</td></tr>




</table>


</div><!-- jd-descr (summary) -->

<!-- Details -->








<!-- XML Attributes -->


<!-- Enum Values -->


<!-- Constants -->


<!-- Fields -->


<!-- Public ctors -->



<!-- ========= CONSTRUCTOR DETAIL ======== -->
<!-- Protected ctors -->



<!-- ========= METHOD DETAIL ======== -->
<!-- Public methdos -->

<h2>Public Methods</h2>



<a id="clone()"></a>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
         
         
         
        synchronized 
        <a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt;
      </span>
      <span class="sympad">clone</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Returns a new CloseableReference to the same underlying SharedReference. The SharedReference
 ref-count is incremented.
</p></div>

    </div>
</div>


<a id="cloneOrNull(com.facebook.common.references.CloseableReference<T>)"></a>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
        static 
         
         
         
        <a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt;
      </span>
      <span class="sympad">cloneOrNull</span>
      <span class="normal">(<a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt; ref)</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Returns the cloned reference if valid, null otherwise.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Parameters</h5>
      <table class="jd-tagtable">
        <tr>
          <th>ref</th>
          <td>the reference to clone
</td>
        </tr>
      </table>
  </div>

    </div>
</div>


<a id="cloneOrNull(java.util.Collection<com.facebook.common.references.CloseableReference<T>>)"></a>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
        static 
         
         
         
        List&lt;<a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt;&gt;
      </span>
      <span class="sympad">cloneOrNull</span>
      <span class="normal">(Collection&lt;<a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt;&gt; refs)</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Clones a collection of references and returns a list. Returns null if the list is null. If
 the list is non-null, clones each reference. If a reference cannot be cloned due to already
 being closed, the list will contain a null value in its place.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Parameters</h5>
      <table class="jd-tagtable">
        <tr>
          <th>refs</th>
          <td>the references to clone</td>
        </tr>
      </table>
  </div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>the list of cloned references or null
</li></ul>
  </div>

    </div>
</div>


<a id="cloneOrNull()"></a>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
         
         
         
        synchronized 
        <a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt;
      </span>
      <span class="sympad">cloneOrNull</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p></p></div>

    </div>
</div>


<a id="close()"></a>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
         
         
         
         
        void
      </span>
      <span class="sympad">close</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Closes this CloseableReference.

 <p>Decrements the reference count of the underlying object. If it is zero, the object
 will be released.

 <p>This method is idempotent. Calling it multiple times on the same instance has no effect.
</p></div>

    </div>
</div>


<a id="closeSafely(java.lang.Iterable<? extends com.facebook.common.references.CloseableReference<?>>)"></a>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
        static 
         
         
         
        void
      </span>
      <span class="sympad">closeSafely</span>
      <span class="normal">(Iterable&lt;?&nbsp;extends&nbsp;<a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;?&gt;&gt; references)</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Closes the references in the iterable handling null.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Parameters</h5>
      <table class="jd-tagtable">
        <tr>
          <th>references</th>
          <td>the reference to close
</td>
        </tr>
      </table>
  </div>

    </div>
</div>


<a id="closeSafely(com.facebook.common.references.CloseableReference<?>)"></a>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
        static 
         
         
         
        void
      </span>
      <span class="sympad">closeSafely</span>
      <span class="normal">(<a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;?&gt; ref)</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Closes the reference handling null.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Parameters</h5>
      <table class="jd-tagtable">
        <tr>
          <th>ref</th>
          <td>the reference to close
</td>
        </tr>
      </table>
  </div>

    </div>
</div>


<a id="get()"></a>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
         
         
         
        synchronized 
        T
      </span>
      <span class="sympad">get</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Returns the underlying Closeable if this reference is not closed yet.
 Otherwise IllegalStateException is thrown.
</p></div>

    </div>
</div>


<a id="getUnderlyingReferenceTestOnly()"></a>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
         
         
         
        synchronized 
        <a href="../../../../com/facebook/common/references/SharedReference.html">SharedReference</a>&lt;T&gt;
      </span>
      <span class="sympad">getUnderlyingReferenceTestOnly</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>A test-only method to get the underlying references.

 <p><b>DO NOT USE in application code.</b>
</p></div>

    </div>
</div>


<a id="getValueHash()"></a>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
         
         
         
        synchronized 
        int
      </span>
      <span class="sympad">getValueHash</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Method used for tracking Closeables pointed by CloseableReference.
 Use only for debugging and logging.
</p></div>

    </div>
</div>


<a id="isValid()"></a>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
         
         
         
        synchronized 
        boolean
      </span>
      <span class="sympad">isValid</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Checks if this closable-reference is valid i.e. is not closed.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if the closeable reference is valid
</li></ul>
  </div>

    </div>
</div>


<a id="isValid(com.facebook.common.references.CloseableReference<?>)"></a>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
        static 
         
         
         
        boolean
      </span>
      <span class="sympad">isValid</span>
      <span class="normal">(<a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;?&gt; ref)</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Checks if the closable-reference is valid i.e. is not null, and is not closed.</p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Returns</h5>
      <ul class="nolist"><li>true if the closeable reference is valid
</li></ul>
  </div>

    </div>
</div>


<a id="of(T)"></a>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
        static 
         
         
         
        <a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt;
      </span>
      <span class="sympad">of</span>
      <span class="normal">(T t)</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Constructs a CloseableReference.

 <p>Returns null if the parameter is null.
</p></div>

    </div>
</div>


<a id="of(T, com.facebook.common.references.ResourceReleaser<T>)"></a>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        public 
        static 
         
         
         
        <a href="../../../../com/facebook/common/references/CloseableReference.html">CloseableReference</a>&lt;T&gt;
      </span>
      <span class="sympad">of</span>
      <span class="normal">(T t, <a href="../../../../com/facebook/common/references/ResourceReleaser.html">ResourceReleaser</a>&lt;T&gt; resourceReleaser)</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p>Constructs a CloseableReference (wrapping a SharedReference) of T with provided
 ResourceReleaser<T>. If t is null, this will just return null.
</p></div>

    </div>
</div>





<!-- ========= METHOD DETAIL ======== -->

<h2>Protected Methods</h2>



<a id="finalize()"></a>

<div class="jd-details api apilevel-"> 
    <h4 class="jd-details-title">
      <span class="normal">
        protected 
         
         
         
         
        void
      </span>
      <span class="sympad">finalize</span>
      <span class="normal">()</span>
    </h4>
      <div class="api-level">
        <div>

</div>
        
  

      </div>
    <div class="jd-details-descr">
      
  <div class="jd-tagdata jd-tagdescr"><p></p></div>
  <div class="jd-tagdata">
      <h5 class="jd-tagtitle">Throws</h5>
      <table class="jd-tagtable">  
        <tr>
            <th>Throwable</td>
            <td></td>
        </tr>
      </table>
  </div>

    </div>
</div>





<!-- ========= END OF CLASS DATA ========= -->
<a id="navbar_top"></a>

<div id="footer">
Generated by <a href="http://code.google.com/p/doclava/">Doclava</a>.
</div> <!-- end footer -->

</div> <!-- jd-content -->

</div><!-- end doc-content -->

</div> <!-- end body-content --> 

<script type="text/javascript">
init(); /* initialize doclava-developer-docs.js */
</script>

</body>
</html>
